<template>
  <view>
    <gosearch @search="search"></gosearch>
    
    
    <swiper circular :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval" :duration="duration">

      <navigator :url="'../../subpkg/goods_detail/goods_detail?goods_id='+item.goods_id" v-for="(item,index) in  bannerList"
        :key="index">
        <swiper-item>
          <image :src="item.image_src"></image>
        </swiper-item>
      </navigator>
    </swiper>

   
    <view class="" style="display: flex;justify-content: space-around;padding:20px 0">
      <view v-for="(item,index)  in  cateList" :key="index">
        <navigator v-if="item.navigator_url"  style="width:100%;display:block" open-type="switchTab" url="../cate/cate">
          <image style="width:60px;height:60px;" :src="item.image_src"></image>
        </navigator>
        <image v-else style="width:60px;height:60px;" :src="item.image_src"></image>
      </view>
    </view>
    
    <view class="" style="padding:10px">
      <view style="margin:20rpx 0 ;" class="" v-for="(item ,index) in  floorList"  :key="index">
        <view class="title">
          <image style="width:300px;height:30px" :src="item.floor_title.image_src"></image>
        </view>
        <view class="container" style="display: flex;">
          
         <view class="left" style="height:130px;">
          
             <image @click="imageBtn(item.product_list[0].navigator_url)" :style="{height:'130px',width:item.product_list[0].image_width+'rpx'}"   :src="item.product_list[0].image_src"></image>
           
         </view>
          
          <view style="display: flex;flex-wrap: wrap;flex;height:130px;justify-content: space-between;flex-direction: column;" class="right">
            
               <image  @click="imageBtn(item2.navigator_url)"   v-if="index2!=0"  v-for="(item2,index2) in item.product_list" :key="index2" :style="{height:'60px',margin:'0  10rpx',width:item.product_list[0].image_width+'rpx'}"   :src="item2.image_src"></image>
             
          </view>
        </view>
      </view>
      
      
    </view>
    
    



  </view>
</template>

<script>
    import mixin  from "../../mixin/tabBarBrage.js"
  export default {
    mixins:[mixin],
    data() {
      return {
        indicatorDots: true,
        vertical: false,
        autoplay: true,
        interval: 1000,
        duration: 500,
        bannerList: [],
        cateList: [],
        floorList:[]
      };
    },
    onLoad() {
      // console.log(uni,77777);
      //console.log(uni.$http.get('/api/public/v1/home/swiperdata'),9999)
      this.getBannerList()

      //uni.showToast();

      //  获取分类数据
      this.getNavList()
      
      //  获取楼层列表
      this.getFloorList()
    },
    methods: {
      show() {
        console.log('；握手')
      },
      async getBannerList() {
        const res = await uni.$http.get('/api/public/v1/home/swiperdata')
        console.log(res, 99888)
        this.bannerList = res.data.message
      },

      //  获取分类导航数据
      async getNavList() {
        const res = await uni.$http.get('/api/public/v1/home/catitems')
        console.log(res, 999)
        this.cateList = res.data.message
      },
      
      //  获取楼层列表
      async getFloorList(){
        const res = await uni.$http.get('/api/public/v1/home/floordata')
       
        this.floorList = res.data.message
      },
      //  跳转到列表页面
      imageBtn(url){
         console.log(url.split('?')[1], 123) //   /pages/list/list?query=女装  =》【‘/pages/list/list’，‘query=女装’】
         
        uni.navigateTo({
          url:'../../subpkg/goods_list/goods_list?'+url.split('?')[1]  //  ../../subpkg/goods_list/goods_list?query=女装       
        })
      },
      
      // 搜索
      search(){
        console.log(1234)
        //  跳转至 搜索页面
        uni.navigateTo({
          url:'../../subpkg/search/search'
        })
        
      }
    }
  }
</script>

<style lang="scss">

</style>
